//=============================================================================
// DirectInput.h by Frank Luna (C) 2005 All Rights Reserved.
//
// Wraps initialization of immediate mode Direct Input, and provides 
// information for querying the state of the keyboard and mouse.
//=============================================================================

#pragma once
#define DIRECTINPUT_VERSION 0x0800
#include <dinput.h>
#pragma comment(lib, "dInput8.lib")
#pragma comment(lib, "dxguid.lib")

class DirectInput
{
public:
	~DirectInput();
	static DirectInput* GetSingleton();
	void Poll();
	bool KeyDown(unsigned char key);
	bool MouseButtonDown(int button);
	float GetMouseDX() const;
	float GetMouseDY() const;
	float GetMouseDZ() const;

		
private:
	DirectInput();

	static DirectInput* m_pDirectInput;
	DWORD KeyboardCoopFlags, MouseCoopFlags;


	IDirectInput8*       m_pDInput;

	IDirectInputDevice8* m_pKeyboard;
	unsigned char        m_KeyboardState[256]; 

	IDirectInputDevice8* m_pMouse;
	DIMOUSESTATE2        m_MouseState;

	void ShowError(HRESULT hr);
private:
	// -------------------------
	// Disabling default copy constructor and default assignment operator.
	// If you get a linker error from one of these functions, your class is internally trying to use them. This is
	// an error in your class, these declarations are deliberately made without implementation because they should never be used.
	// -------------------------
	DirectInput(const DirectInput& t);
	DirectInput& operator=(const DirectInput& t);


};

